//
//  LLExcelInfoVc.m
//  106Lottery
//
//  Created by MrLee on 2017/7/10.
//  Copyright © 2017年 刘元富. All rights reserved.
//

#import "LLExcelInfoVc.h"
#import <WebKit/WebKit.h>


@interface LLExcelInfoVc ()<WKNavigationDelegate>
@property(nonatomic,strong)WKWebView *infoWebView;
@end

@implementation LLExcelInfoVc

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    [self initUI];
}

-(void)initUI
{
    [self.navigationItem setTitle:_titleStr];
    
    _infoWebView = [[WKWebView alloc]initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, DEF_CONTENT_INTABBAR_HEIGHT)];
    _infoWebView.navigationDelegate = self;
    NSMutableURLRequest *request =[NSMutableURLRequest requestWithURL:[NSURL URLWithString:_htmlUrl]];
    [_infoWebView  loadRequest:request];
}
#pragma mark - WKWebViewDelegate

- (void)webView:(WKWebView *)webView didStartProvisionalNavigation:(null_unspecified WKNavigation *)navigation
{
    [MXUtility showMBProgress:self.view message:LoadingText];
}
- (void)webView:(WKWebView *)webView didFailProvisionalNavigation:(null_unspecified WKNavigation *)navigation withError:(NSError *)error
{
    [MXUtility showMBProgress:self.view message:@"加载失败,请稍后重试"];
    
}

- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation
{
    [MXUtility hideMBProgress:self.view];

    dispatch_time_t delayTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1/*延迟执行时间*/ * NSEC_PER_SEC));
    
    dispatch_after(delayTime, dispatch_get_main_queue(), ^{
        
        [self.view addSubview:_infoWebView];
    });
    
}
@end
